﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using Chowpoo.Sql;

namespace CourseSystem.Core.Entities
{
    [Table(Name = "CommonResources")]
    public class CommonResourcesInfo :  IDetach
    {
        public CommonResourcesInfo()
        {
            Detach();
        }
        #region Model
        private int _id;
        private byte _type = 0;
        private byte _mintype = 0;
        private string _title = "";
        private string _author = "";
        private string _filename = "";
        private int _hits = 0;
        private DateTime _uploaddate = DateTime.Now;
        private int _uploaderid = 0;
        private byte _uploadertype = 0;
        private int _exid = 0;
        private string _message = "";

        [Column(IsDbGenerated = true, IsPrimaryKey = true, IsVersion = true)]
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }

        /// <summary>
        /// 1文本2图像3Flash4音频5视频6PPT7学习包
        /// </summary>
        [Column]
        public byte Type
        {
            set { _type = value; }
            get { return _type; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("类型")]
        public byte MinType
        {
            set { _mintype = value; }
            get { return _mintype; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("标题")]
        [Required(ErrorMessage="必须填写")]
        public string Title
        {
            set { _title = value; }
            get { return _title; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        [DisplayName("作者")]
        public string Author
        {
            set { _author = value; }
            get { return _author; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public string FileName
        {
            set { _filename = value; }
            get { return _filename; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int Hits
        {
            set { _hits = value; }
            get { return _hits; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public DateTime UploadDate
        {
            set { _uploaddate = value; }
            get { return _uploaddate; }
        }
        /// <summary>
        /// 
        /// </summary>
        [Column]
        public int UploaderId
        {
            set { _uploaderid = value; }
            get { return _uploaderid; }
        }
        /// <summary>
        /// 1学生2教师(管理员)
        /// </summary>
        [Column]
        public byte UploaderType
        {
            set { _uploadertype = value; }
            get { return _uploadertype; }
        }
        /// <summary>
        /// 备用字段,扩展用
        /// </summary>
        [Column]
        public int ExId
        {
            set { _exid = value; }
            get { return _exid; }
        }

        /// <summary>
        /// 内容
        /// </summary>
        [Column]
        [DisplayName("内容")]
        public string Message
        {
            set { _message = value; }
            get { return _message; }
        }
        #endregion Model

        public void Detach()
        {

        }
    }
}
